function Daily_Data(data, tableid) {
	var buffer = new StringBuffer();
	$(data).each(function(i,info){
		try{
		info.Context=decodeURI(info.Context);
		info.Plans=decodeURI(info.Plans);
		info.Experience=decodeURI(info.Experience);
		}catch(e){}
		var btn_txt="回复";
		if(info.Identity==2 && info.State==0)
		{
			btn_txt="批阅";
		}
		buffer.append('<div class="sharelist border-bottom" tableid="'+tableid+'" id="'+info.ID+'" userid="'+info.UserID+'" username="'+info.RealName+'">');
		buffer.append('<div class="atitle">');
		buffer.append('<div class="aimg"><img src="'+info.HeadImg+'"/></div>');
		buffer.append('<div class="aname">'+info.RealName+'<font class="'+(info.State==0?"reds":"greens")+'">'+info.StateText+'</font></div>');
		buffer.append('<div class="adate">'+info.CreateTime+'  &nbsp;&nbsp;&nbsp;&nbsp; 来自&nbsp;'+info.Version+'</div>');
		buffer.append('<div class="atag">日志</div>');
		buffer.append('</div>');
		if(info.ToUsers!="")
		{
			buffer.append('<div class="asendrange">抄送给：<font>'+info.ToUsers+'</font></div>');
		}
		buffer.append('<div class="aexeuser">该日志由 <a href="">'+info.CommentUserName+'</a> 批阅</div>');
		buffer.append('<div class="awork">'+GetDaily_Type(info.DailyType,"this")+'工作总结：</div>');
		buffer.append('<div class="acontent"><span>' + info.Context + '</span><div id="detail">'+info.Context.DHtml().Cut()+'</div></div>');
		if(info.Plans!="")
		{
			buffer.append('<div class="awork">'+GetDaily_Type(info.DailyType,"next")+'工作计划：</div>');
			buffer.append('<div class="acontent"><span>'+info.Plans+'</span><div id="detail">'+info.Plans.DHtml().Cut()+'</div></div>');
		}
		if(info.Experience!="")
		{
			buffer.append('<div class="awork">心得体会：</div>');
			buffer.append('<div class="acontent"><span>'+info.Experience+'</span><div id="detail">'+info.Experience.DHtml().Cut()+'</div></div>');
		}
		buffer.append('<div class="aimg">');
		$(info.Imgs).each(function(k,img)
		{
		var right=k%3==2?0:5;
		buffer.append('<figure class="asquare" style="width:'+(swidth-30)/3+'px; heigth:'+(swidth-30)/3+'px; margin-right:'+right+'px; float:left; display:block;" itemscope itemtype="http://schema.org/ImageObject"><a src="'+img.Img1000+'" itemprop="contentUrl" data-size="'+img.Width+'x'+img.Height+'"><img src="' + img.Img200 + '" width="'+(swidth-30)/3+'" height="'+(swidth-30)/3+'" itemprop="thumbnail" alt="Image description"/></a></figure>');
		});
		buffer.append('</div>');
		if(info.Files.length>0)
		{
		buffer.append('<div class="afile">');
		$.each(info.Files,function(i,info)
		{
					buffer.append('<div class="file_list">');
						buffer.append('<div class="file_icon"><img src="img/'+GetICON(info.Path)+'"/></div>');
						buffer.append('<div class="file_info">');
							buffer.append('<div class="file_name">' + info.Name + '</div>');
							buffer.append('<div class="file_size">' + GetSize(info.Size) + '</div>');  
						buffer.append('</div>');
						buffer.append('<div class="file_download"><a href="javascript:void(0)" onclick=DownLoad(this,"'+info.Path+'")></a></div>');
					buffer.append('</div>');
		});
		buffer.append('</div>');
		}
		
		if(info.Address!=""){
		buffer.append('<div class="aposition"><div class="icon"><img src="img/position2.png" height="22"/></div><div class="address">'+info.Address+'</div></div>');
		}
		buffer.append('<div class="atool">');
		if(info.UserID==userid){
		buffer.append('<div class="delete"><img src="img/delete.png" height="12"/></div>');
		}
		buffer.append('<div class="reply" text="'+btn_txt+'"><img src="img/replyes.png" height="12"/></div></div>');
		if(info.ReplyList.length>0)
		{
			buffer.append('<div class="replylist">');
			$(info.ReplyList).each(function(i,reply){
				try{
				reply.Context=decodeURI(reply.Context);
				}catch(e){}
				if(reply.ParentID==0)
				{
					buffer.append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" tableid="'+tableid+'" username="'+reply.UserName+'" sid="'+info.ID+'" parentid="'+reply.ParentID+'"><font>'+reply.UserName+'：</font>'+reply.Context+'</div>');
				}else{
					buffer.append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" tableid="'+tableid+'" username="'+reply.UserName+'" sid="'+info.ID+'" parentid="'+reply.ParentID+'"><font>'+reply.UserName+'</font>回复<font>'+reply.ToUserName+'：</font>'+reply.Context+'</div>');
				}
			});
			buffer.append('</div>');
		}
		buffer.append('</div>');
	});
	return buffer.toString();
};

function GetDaily_Type(dailytype, flag) {
    if (flag == "this") {
        if (dailytype == 1) { return "今日"; }
        else if (dailytype == 2) { return "本周"; }
        else if (dailytype == 3) { return "本月"; }
    } else {
        if (dailytype == 1) { return "明日"; }
        else if (dailytype == 2) { return "下周"; }
        else if (dailytype == 3) { return "下月"; }
    }
};

function Init_Daily(){
	get("divmsgname").addEventListener("tap",function(){
		OpenOAScreen(Daily_Search_Code(),function(){
			Init_Daily_Search();
		},function(){Data_Search(2)});
	});
	
};

function Daily_Search_Code(){
	var buffer = new StringBuffer();
	buffer.append('<div class="searchtab"><div class="tab select" val="out">我发出的</div><div class="tab" val="in">我收到的</div></div>');
	buffer.append('<div class="searchline" style="margin-top:10px;"><div class="names">选择同事</div><div class="option"><input id="users_search" class="users" show="1" touserid="" todepartid="" tocomid="" type="text" placeholder="点击选择" readonly="readonly" value=""/></div></div>');
	buffer.append('<div class="searchline"><div class="names">日志状态</div><div class="option"><select id="state_search"><option value="">全部</option><option value="0">未批阅</option><option value="1">已批阅</option></select></div></div>');
	buffer.append('<div class="searchline"><div class="names">发布时间</div><div class="option"><input id="begindate_search" type="text" class="date" placeholder="开始时间" readonly="readonly"/><input id="enddate_search" type="text" class="date" placeholder="结束时间" readonly="readonly"/></div></div>');
	return buffer.toString();
};

function Init_Daily_Search(){
	mui(".searchtab").on("tap",".tab",function(){
		if($(this).attr("val")=="out")
		{
			$(this).css("border-right","1px solid #e3e2e2").siblings().css("border-left","0px");
		}else
		{
			$(this).css("border-left","1px solid #e3e2e2").siblings().css("border-right","0px");
		}
		$(this).addClass("select").siblings().removeClass("select");
		Data_Search(2);
	});
	mui(".option").on("tap",".date",function(){
		obj=this;
			var t=new Date();
			if($(this).val()!="")
			{
				var year_month_day=$(this).val().split("-");
				t.setFullYear(year_month_day[0]);
				t.setMonth(year_month_day[1]-1);
				t.setDate(year_month_day[2]);
			}
			plus.nativeUI.pickDate( function(e){
				var d=e.date;
				$(obj).val((d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()).ToDate());
			},function(e){
				console.log( "未选择日期："+e.message );
			},{date:t});
	});
	get("users_search").addEventListener("tap",function(){
        	obj10=$(this);
			OpenWindow(3,"选择员工","确定",function(){
					var str1="",str2="",str3="",headimg="";
					touserid="";todepartid="";tocomid="";
	      			var count=0;
	      			mui.each(mui("#userlist input"),function(i,info){
	      				if(info.checked)
	      				{
	      					count++;
	      					touserid += info.value+",";
	      					str1 += info.getAttribute("val")+",";
	      				}
	      			});
	      			if(touserid.TrimEnd(",").split(",").length>1)
					{
						plus.nativeUI.toast("请选择1个员工");
						return;
					}
					if(str1=="")
	      			{
	      				obj10.val("").attr("touserid","");
	      			}else
	      			{
	      				obj10.val(str1.substring(0,str1.length-1)).attr("touserid",touserid.substring(0,touserid.length-1));
	      			}
	      			CloseWindow();
			});
			
			$("#contentlist3").html(CheckMate_Data());
			data = {};
			data.act = "DepartAndUser_Data";
			data.userid=userid;
			data.comid=comid;
			data.source=source;
			data.sign=GetSign(data.act);
			
			mui.getJSON(admin_domain, data, function(json) {
				Bind_CheckMate(json.data.user,json.data.depart);
				Init_CheckMate();
			});
			if($(this).attr("show")=="1")
	      	{
	      		$(".selectbar").hide();
	      	}else
	      	{
				$(".selectbar").show();  				
	      	}
	    });

};